package cn.zysuyuan.item.service.impl;

import cn.zysuyuan.common.entity.PageResult;
import cn.zysuyuan.common.utils.UUIDUtil;
import cn.zysuyuan.item.entity.Company;
import cn.zysuyuan.item.mapper.CompanyMapper;
import cn.zysuyuan.item.service.CompanyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author flypig
 * @version 1.0
 * @date 2019/10/29 13:55
 */

@Service
public class CompanyServiceImpl implements CompanyService {

    @Autowired
    private CompanyMapper companyMapper;


    @Override
    public PageResult<Company> selectList(Map<String, Object> map) {

        List<Company> companies = this.companyMapper.selectList(map);
        return new PageResult<Company>(companies);
    }

    @Override
    public PageResult<Company> selectcName() {
        List<Company> cNames = this.companyMapper.selectcName();
        return new PageResult<Company>(cNames);
    }

    @Override
    public int insert(Company company) {
        company.setId(UUIDUtil.uuid());
        company.setcCreateTime(new Date());
        return this.companyMapper.insert(company);
    }

    @Override
    public int delete(String id) {
        return this.companyMapper.delete(id);
    }

    @Override
    public int update(Company company) {
        return this.companyMapper.update(company);
    }
}
